def sumlist() :
    list1 = []
    while True :
        ques = str(input("是否要添加元素y/n："))
        if ques == 'y':
            a = int(input("请输入添加到列表的数字："))
        else:
            break
        list1.append(a)
    print("数组结构如下：",list1)
    total = 0
    ele = 0
    for ele in range(0,len(list1)) :
        total = total + list1[ele]
    print("列表元素之和为：",total)
sumlist()